package com.l.demo.model;

import lombok.Data;
// java21 代码
import jakarta.validation.constraints.*;

// java8 代码
//import javax.validation.constraints.*;

@Data
public class MyUserVo {
    private Integer id;

    @NotBlank(message = "用户名不能为空")
    private String username;

    @NotBlank(message = "密码不能为空")
    private String password;

    public String valid(){
        if (username == null || username.isEmpty()) {
            return "用户名为空";
        }
        if (password == null || password.isEmpty()) {
            return "密码为空";
        }
        return null;
    }
}